package net.lagou.mathsort;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/**
 * @author zhangwei
 * @date 2020/8/11  23:26
 * @jdkversion 1.8
 * @description Reduse输出的key类型
 */
public class NumberBean implements Writable{
    //序号
    private Long serial;
    //数字
    private Long  number;

    public NumberBean() {
    }

    public NumberBean(Long serial, Long number) {
        this.serial = serial;
        this.number = number;
    }

    public Long getSerial() {
        return serial;
    }

    public void setSerial(Long serial) {
        this.serial = serial;
    }

    public Long getNumber() {
        return number;
    }

    public void setNumber(Long number) {
        this.number = number;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeLong(serial);
        dataOutput.writeLong(number);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.serial=dataInput.readLong();
        this.number=dataInput.readLong();
    }

    @Override
    public String toString() {
        return serial +
                "\t" + number;
    }
}
